package cn.xval.ft.app.gen.controller;

import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.xval.fc.base.response.WrapResponse;
import cn.xval.ft.app.gen.service.FrontHostService;
import jakarta.annotation.Resource;
import cn.xval.ft.app.gen.params.FrontHostParams;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.validation.annotation.Validated;
import jakarta.validation.constraints.NotNull;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.PostMapping;
import cn.xval.fc.base.exception.BusinessException;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.List;

@Tag(name="FrontHost", description="")
@RequestMapping(path = "/host")
@RestController
@WrapResponse
public class FrontHostController {
    @Resource
    private FrontHostService frontHostService;
    @Operation(summary = "添加前置信息")
    @PostMapping("create")
    public FrontHostParams.FrontHostInfo create(@RequestBody @Validated @NotNull FrontHostParams.FrontHostCreateRequest arg) throws BusinessException {
        return this.frontHostService.create(arg);
    }
    @Operation(summary = "修改前置信息")
    @PostMapping("modify")
    public FrontHostParams.FrontHostInfo modify(@RequestBody @Validated @NotNull FrontHostParams.FrontHostModifyRequest arg) throws BusinessException {
        return this.frontHostService.modify(arg);
    }
    @Operation(summary = "删除前置信息")
    @GetMapping("remove/{id}")
    public void remove(@PathVariable("id") String id) throws BusinessException {
        this.frontHostService.remove(id);
    }
    @Operation(summary = "查询前置列表")
    @GetMapping("query")
    public List<FrontHostParams.FrontHostInfo> query() throws BusinessException {
        return this.frontHostService.query();
    }
}

